package demo.redisson.controller;

import cn.hutool.http.HttpUtil;
import demo.redisson.service.RedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @date: 2023/2/20 17:47
 */
@RestController
@RequestMapping("/redisson")
public class TestController {

    @Autowired
    private RedisService redisService;

    @GetMapping("test")
    public Integer test() {
        return redisService.genSn();
    }

    public static void main(String[] args) {
        for (int i = 0; i < 1000; i++) {
            new Thread(() -> {
                Integer sn = Integer.valueOf(HttpUtil.get("localhost:8046/redisson/test"));
            }).start();
        }
    }

}
